//
//  MFAPMZombineProxy.m
//  MFAPMManager
//
//  Created by zhang liyu on 2019/5/28.
//

#import "MFAPMZombineProxy.h"

NSString *kMFAPMZombineSnifferCallNotification = @"kMFAPMZombineSnifferCallNotification";
#define MFAPMZombieMesssageSentHandler() [self mfapm_zombieMesssageSentHandler:_cmd]
@implementation MFAPMZombineProxy

#pragma mark - Message Transfer Actions

- (BOOL)respondsToSelector:(SEL)aSelector{
    return [self.originClass instancesRespondToSelector:aSelector];
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel{
    return [self.originClass instanceMethodSignatureForSelector:sel];
}

- (void)forwardInvocation:(NSInvocation *)invocation{
    [self mfapm_zombieMesssageSentHandler:invocation.selector];
}

#pragma mark - Original Class Actions

- (Class)class{
    MFAPMZombieMesssageSentHandler();
    return nil;
}

- (BOOL)isEqual:(id)object{
    MFAPMZombieMesssageSentHandler();
    return NO;
}

- (NSUInteger)hash{
    MFAPMZombieMesssageSentHandler();
    return 0;
}

- (id)self{
    MFAPMZombieMesssageSentHandler();
    return nil;
}

- (BOOL)isKindOfClass:(Class)aClass{
    MFAPMZombieMesssageSentHandler();
    return NO;
}

- (BOOL)isMemberOfClass:(Class)aClass{
    MFAPMZombieMesssageSentHandler();
    return NO;
}

- (BOOL)conformsToProtocol:(Protocol *)aProtocol{
    MFAPMZombieMesssageSentHandler();
    return NO;
}

- (BOOL)isProxy{
    MFAPMZombieMesssageSentHandler();
    return NO;
}

- (id)retain{
    MFAPMZombieMesssageSentHandler();
    return nil;
}

- (oneway void)release{
    MFAPMZombieMesssageSentHandler();
}

- (id)autorelease{
    MFAPMZombieMesssageSentHandler();
    return nil;
}

- (void)dealloc{
    MFAPMZombieMesssageSentHandler();
    [super dealloc];
}

- (NSUInteger)retainCount{
    MFAPMZombieMesssageSentHandler();
    return 0;
}

- (NSZone *)zone{
    MFAPMZombieMesssageSentHandler();
    return nil;
}

- (NSString *)description{
    MFAPMZombieMesssageSentHandler();
    return nil;
}

#pragma mark - Zombine Message Sent Handle Actions

- (void)mfapm_zombieMesssageSentHandler:(SEL)selector{
    
    NSDictionary *zombineDataDict = [@{
                                      @"zombineClassName" : NSStringFromClass(self.originClass) ? : @"",
                                      @"zombineFuncName" : NSStringFromSelector(selector) ? : @"",
                                      @"zombineCallerAddress" : [NSString stringWithFormat:@"%p", self] ? : @"",
                                      } autorelease];
    //发出通知，当前zombine对象被调用
    [[NSNotificationCenter defaultCenter] postNotificationName:kMFAPMZombineSnifferCallNotification object:zombineDataDict];
}



@end
